package cn.signalpha.common.utils;

import cn.signalpha.core.tool.utils.DateUtil;

/**
 * 类说明
 *
 * @author suguangjun
 */
public class OrderUtil {

	/**
	 * 商城订单
	 */
	public final static String SHOP_ORDER = "SO";
	/**
	 * 提现单号
	 */
	public final static String WITHDRAW = "WD";

    /**
     * 获取订单号
     * @param flag 订单前缀
     * @return 订单号
     */
    public static String getOrderNo(String flag){
        String data = DateUtil.formatDateTimeMini(DateUtil.now());
        //四位随机数
        String verificationCode = String.valueOf(Math.round(Math.random()*10000));
        if(verificationCode.length() < 4){
            verificationCode = String.format("%4d", verificationCode.length()).replace(" ", "0");
        }
        return flag + data + verificationCode;
    }

}
